home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / Attribute.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  4.5 KB  |  171 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.EOFException;
  6. import java.io.IOException;
  7. import java.util.Vector;
  8. import symjava.sql.SQLException;
  9.  
  10. public class Attribute extends ServerObject {
  11.    String _name;
  12.    int _type;
  13.    int _precision;
  14.    int _scale;
  15.    boolean _isAutoIncrement;
  16.    boolean _isCaseSensitive;
  17.    boolean _isSearchable;
  18.    boolean _isCurrency;
  19.    int _isNullable;
  20.    boolean _isSigned;
  21.    int _columnDisplaySize;
  22.    String _columnLabel;
  23.    String _schemaName;
  24.    String _tableName;
  25.    String _catalogName;
  26.    String _columnTypeName;
  27.    boolean _readOnly;
  28.    boolean _writable;
  29.    boolean _definitelyWritable;
  30.  
  31.    Attribute() {
  32.    }
  33.  
  34.    int getType() {
  35.       return 62;
  36.    }
  37.  
  38.    void read(DataInputStream in) throws SQLException, IOException, ErrorException {
  39.       in.readShort();
  40.  
  41.       try {
  42.          ServerObject obj = (ServerObject)NetClass.getNextObject(in);
  43.          if (obj.getType() != 54) {
  44.             throw new SQLException("Object Stream error in Attribute object");
  45.          } else {
  46.             Vector props = ((ServerList)obj).getObjVector();
  47.             NetData d = (NetData)props.elementAt(0);
  48.             this._isAutoIncrement = d.getBool();
  49.             d = (NetData)props.elementAt(1);
  50.             this._isCaseSensitive = d.getBool();
  51.             d = (NetData)props.elementAt(2);
  52.             this._isSearchable = d.getBool();
  53.             d = (NetData)props.elementAt(3);
  54.             this._isCurrency = d.getBool();
  55.             d = (NetData)props.elementAt(4);
  56.             this._isNullable = d.getShort();
  57.             d = (NetData)props.elementAt(5);
  58.             this._isSigned = d.getBool();
  59.             d = (NetData)props.elementAt(6);
  60.             this._columnDisplaySize = d.getInt();
  61.             NetString s = (NetString)props.elementAt(7);
  62.             this._columnLabel = s.getString();
  63.             s = (NetString)props.elementAt(8);
  64.             this._name = s.getString();
  65.             s = (NetString)props.elementAt(9);
  66.             this._schemaName = s.getString();
  67.             d = (NetData)props.elementAt(10);
  68.             this._precision = d.getInt();
  69.             d = (NetData)props.elementAt(11);
  70.             this._scale = d.getInt();
  71.             s = (NetString)props.elementAt(12);
  72.             this._tableName = s.getString();
  73.             s = (NetString)props.elementAt(13);
  74.             this._catalogName = s.getString();
  75.             d = (NetData)props.elementAt(14);
  76.             this._type = d.getShort();
  77.             s = (NetString)props.elementAt(15);
  78.             this._columnTypeName = s.getString();
  79.             d = (NetData)props.elementAt(16);
  80.             this._readOnly = d.getBool();
  81.             d = (NetData)props.elementAt(17);
  82.             this._writable = d.getBool();
  83.             d = (NetData)props.elementAt(18);
  84.             this._definitelyWritable = d.getBool();
  85.          }
  86.       } catch (EOFException var6) {
  87.          throw new SQLException("Object Stream error in Attribute object");
  88.       }
  89.    }
  90.  
  91.    void write(DataOutputStream out) throws IOException {
  92.       throw new IOException("Write not permitted on Attribute object");
  93.    }
  94.  
  95.    public boolean isAutoIncrement() throws SQLException {
  96.       return this._isAutoIncrement;
  97.    }
  98.  
  99.    public boolean isCaseSensitive() throws SQLException {
  100.       return this._isCaseSensitive;
  101.    }
  102.  
  103.    public boolean isSearchable() throws SQLException {
  104.       return this._isSearchable;
  105.    }
  106.  
  107.    public boolean isCurrency() throws SQLException {
  108.       return this._isCurrency;
  109.    }
  110.  
  111.    public int isNullable() throws SQLException {
  112.       return this._isNullable;
  113.    }
  114.  
  115.    public boolean isSigned() throws SQLException {
  116.       return this._isSigned;
  117.    }
  118.  
  119.    public int getColumnDisplaySize() throws SQLException {
  120.       return this._columnDisplaySize;
  121.    }
  122.  
  123.    public String getColumnLabel() throws SQLException {
  124.       return this._columnLabel;
  125.    }
  126.  
  127.    public String getColumnName() throws SQLException {
  128.       return this._name;
  129.    }
  130.  
  131.    public String getSchemaName() throws SQLException {
  132.       return this._schemaName;
  133.    }
  134.  
  135.    public int getPrecision() throws SQLException {
  136.       return this._precision;
  137.    }
  138.  
  139.    public int getScale() throws SQLException {
  140.       return this._scale;
  141.    }
  142.  
  143.    public String getTableName() throws SQLException {
  144.       return this._tableName;
  145.    }
  146.  
  147.    public String getCatalogName() throws SQLException {
  148.       return this._catalogName;
  149.    }
  150.  
  151.    public int getColumnType() throws SQLException {
  152.       return this._type;
  153.    }
  154.  
  155.    public String getColumnTypeName() throws SQLException {
  156.       return this._columnTypeName;
  157.    }
  158.  
  159.    public boolean isReadOnly() throws SQLException {
  160.       return this._readOnly;
  161.    }
  162.  
  163.    public boolean isWritable() throws SQLException {
  164.       return this._writable;
  165.    }
  166.  
  167.    public boolean isDefinitelyWritable() throws SQLException {
  168.       return this._definitelyWritable;
  169.    }
  170. }
  171.